using System;
using System.Web.Mvc;
using System.Web.Routing;

namespace Pronghorn.Core
{
	public class ProngHornControllerContext : ControllerContext, IProngHornControllerContext
	{
		private ProngHornControllerBase _controller;
		private ISiteContext _siteContext;

		public ProngHornControllerContext(RequestContext requestContext, ProngHornControllerBase controller, ISiteContext siteContext)
		{
			if (requestContext == null)
			{
			    throw new ArgumentNullException("requestContext");
			}

			RequestContext = requestContext;
			Controller = controller;
			SiteContext = siteContext;
		}

		public new ProngHornControllerBase Controller
		{
			get
			{
					return _controller;
			}
			set
			{
				if (value == null)
				{
					throw new NullReferenceException("The controller can't be null.");
				}
				_controller = value;
				base.Controller = value;
			}
		}

		public ISiteContext SiteContext
		{
			get { return _siteContext; }
				set
				{
				if (value == null)
				{
					throw new NullReferenceException("The siteContext can't be null.");
				}
					_siteContext = value;
				}
		}
	}
}